'use strict';

const Controller = require('egg').Controller;

class BaseController extends Controller {
  constructor(ctx) {
    super(ctx);
  }
  /**
   *
   * @param {Promise} promise
   * @return {{success:boolean,data?:unknown,message?:string}}
   */
  async result(promise) {
    return await this.ctx.helper.result(promise).then(data => (this.ctx.body = data));
  }
}
module.exports = BaseController;
